package edu.tsinghua.mrpvc.device.lightsensor;

import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

import edu.tsinghua.mrpvc.device.LightSensor;
//import edu.tsinghua.mrpvc.simulate.util.SimulateTopic;


public class Activator implements BundleActivator, EventHandler {

//	private LightSensorImpl lightSensor = null;
//	private static final String[] RESPONSE_TOPICS = {LightSensor.EVENT_TOPIC_ISVALID, LightSensor.EVENT_TOPIC_LIGHTLEVEL};
	//private static final String[] SIMULATE_TOPICS = {SimulateTopic.LIGHT_SENSE};
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
//		lightSensor = new LightSensorImpl(context, "1");
//		context.registerService(LightSensor.class.getName(), lightSensor, null);
//		
//		Dictionary<String, Object> resProperty = new Hashtable<String, Object>();
//		resProperty.put(EventConstants.EVENT_TOPIC, RESPONSE_TOPICS);
//		context.registerService(EventHandler.class.getName(), lightSensor, resProperty);
//		
		//Dictionary<String, Object> simuProperty = new Hashtable<String, Object>();
		//simuProperty.put(EventConstants.EVENT_TOPIC, SIMULATE_TOPICS);
		//context.registerService(EventHandler.class.getName(), this, simuProperty);
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	}

	@Override
	public void handleEvent(Event event) {
		// TODO Auto-generated method stub
		//this.lightSensor.sense();		
	}

}
